package edu.ptu.acl.dto.param;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Data
public class DeptParam {

    @Min(value = 10000000000000000L,message = "id不规范" ,groups = Update.class)
    private Long id;

    @Length(min = 1,max = 20,message = "部门名字长度必须是1-20个字符",groups = {Save.class, Update.class})
    private String name;

    @NotNull(message = "上级部门不能为空")
    private Long parentId;

    @NotNull(message = "所在层级中的顺序不能为空",groups = {Update.class,Save.class})
    @Max(value = 123,message = "seq最大123",groups = {Update.class, Save.class})
    private Integer seq;

    @NotNull(message = "乐观锁版本不能为空",groups = {Update.class})
    private Integer version;

    /**
     * 保存的时候校验分组
     */
    public interface Save {
    }

    /**
     * 更新的时候校验分组
     */
    public interface Update {
    }
}
